package com.baomidou.samples.jpa.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.samples.jpa.dao.UserRepository;
import com.baomidou.samples.jpa.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    @DS("slave_1")
    @Override
    public List<User> selectAllUsers() {
        return userRepository.findAll();
    }
}
